import Vue from "vue";
import Vuex from "vuex";
import * as actions from "./actions";
import * as getters from "./getters";
import mutations from "./mutations";
import createPersistedState from "vuex-persistedstate";

Vue.use(Vuex);

export default new Vuex.Store({
  actions,
  getters,
  mutations,
  state: {
    token: "",
    username: "",
    settingDialogShow: false,
    setUserDialogShow: false, //用户名
    wsalgresult: [],
    currTabItem: {},
    // {
    //   taskId
    //   algorithmId
    //   algorithmType
    //   functionName
    //   fileId
    //   fileName
    //   userInputParams
    // }
    wsInstance: null,
    newFrequencyResolutionInStore: null, //模块4右侧参数设置---频率分辨率字段
    samplingRate: 100000, //采样率，默认100KHz
  },
  plugins: [
    createPersistedState({
      storage: window.localStorage, // 使用localStorage来存储数据
      blacklist: ["wsInstance"],
      // 可以添加一些配置选项，例如key前缀或reducer函数
    }),
  ],
});
